package cn.baddonkey.photography.agent.service.impl;

import cn.baddonkey.photography.agent.service.UserService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import cn.baddonkey.photography.agent.entity.UserInfo;
import cn.baddonkey.photography.agent.mapper.UserInfoMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserInfoMapper userInfoMapper;

    @Override
    public UserInfo selectUserByUserName(String userName) {
        return userInfoMapper.selectOne(
                Wrappers.<UserInfo>lambdaQuery()
                        .eq(UserInfo::getUserName, userName)
                        .eq(UserInfo::getDeleted, false)
                        .last("limit 1"));
    }
}
